/*
 * Copyright 2020-2025 the original author or authors.
 * You cannot use this file unless authorized by the author.
 */

package org.ipig.data.mongo;

/**
 * mongo操作
 *
 * @author <a href="mailto:comchnts@163.com">chinats</a>
 * @version $$Id: MongoOperators.java 3 2020-01-21 09:36:33Z ts <comchnts@163.com> $$
 * @since 1.0
 */
public class MongoOperators {
    public static final String OR = "$or";
    public static final String AND = "$and";
    public static final String GT = "$gt";
    public static final String GTE = "$gte";
    public static final String LT = "$lt";
    public static final String LTE = "$lte";

    public static final String NE = "$ne";
    public static final String IN = "$in";
    public static final String NIN = "$nin";
    public static final String MOD = "$mod";
    public static final String ALL = "$all";
    public static final String SIZE = "$size";
    public static final String EXISTS = "$exists";
    //子文档查询 多条件关联
    public static final String ELEM_MATCH = "$elemMatch";

    // (to be implemented in QueryBuilder)
    public static final String WHERE = "$where";
    public static final String NOR = "$nor";
    public static final String TYPE = "$type";
    public static final String NOT = "$not";

    // geo operators
    public static final String WITHIN = "$within";
    public static final String NEAR = "$near";
    public static final String NEAR_SPHERE = "$nearSphere";
    public static final String BOX = "$box";
    public static final String CENTER = "$center";
    public static final String POLYGON = "$polygon";
    public static final String CENTER_SPHERE = "$centerSphere";
    // (to be implemented in QueryBuilder)
    public static final String MAX_DISTANCE = "$maxDistance";
    public static final String UNIQUE_DOCS = "$uniqueDocs";

    // text operators
    public static final String TEXT = "$text";
    public static final String SEARCH = "$search";
    public static final String LANGUAGE = "$language";

    // meta query operators (to be implemented in QueryBuilder)
    public static final String RETURN_KEY = "$returnKey";
    public static final String MAX_SCAN = "$maxScan";
    public static final String ORDER_BY = "$orderby";
    public static final String EXPLAIN = "$explain";
    public static final String SNAPSHOT = "$snapshot";
    public static final String MIN = "$min";
    public static final String MAX = "$max";
    public static final String SHOW_DISK_LOC = "$showDiskLoc";
    public static final String HINT = "$hint";
    public static final String COMMENT = "$comment";

    //meta aggregate operators
    public static final String MATCH = "$match";
    public static final String SORT = "$sort";
    public static final String LIMIT = "$limit";
    public static final String PROJECT = "$project";

    //遍历数组
    public final static String EACH = "$each";
    //不可用于截取中文
    public final static String SUB_STR_BYTES = "$substrBytes";
    //可用于截取中文
    public final static String SUB_STR_CP = "$substrCP";
    //聚合的分组
    public final static String GROUP = "$group";
    //正则匹配
    public final static String REGEX = "$regex";
    //等于
    public final static String EQUALS = "$eq";
    //数组转列表
    public final static String UNWIND = "$unwind";


    //
    public final static String SET = "$set";
    //
    public final static String UN_SET = "$unset";
    //nsert的时候set
    public final static String SET_ON_INSERT = "$setOnInsert";
    //累加$inc操作符接收正的和负的值,
    // 如果指定的字段不存在则$inc操作符创建这个字段并且设置这个字段的值为指定的在值；
    // 如果值为null则将会报异常；
    //$inc操作符是原子性的在单个文档中；
    public final static String INC = "$inc";
    //增加到数组（去重）
    public final static String ADD_TO_SET = "$addToSet";
    /** SUM   */
    public static final String SUM = "$sum";

    //---------------统计命令---------------
    //查看单个集合的存储信息
    public static final String COLL_STATS = "collStats";
    //返回指定数据库的存储信息
    public static final String DB_STATS = "dbStats";
    //查看复制集的状态
    public static final String REPL_SET_GET_STATUS = "replSetGetStatus";



    private MongoOperators() {
    }
}
